package org.zjt.book

/**
  * DESC    
  *
  * @author
  * @create 2017-04-26 上午11:37
  **/
object TupleTest {

  def main(args: Array[String]): Unit = {
    var tuple = (1,2,3,3.23)
    println(tuple._4 )


    var tupleName1 = tuple
    println(tupleName1.toString() )


    /**
      * zip将多个数组组合成对偶的元组 (zhangsan,23),(lisi,45)
      */
    var zipTuple = Array("zhangsan","lisi").zip(Array(23,45))
    println(zipTuple.mkString(",") )   //(zhangsan,23),(lisi,45)



    //tuple遍历
    zipTuple.map( a => (a,1) ).foreach( a => println(a))
    zipTuple.foreach( a => println(a._1 +"$"+ a._2))

  }

}
